#include <stdio.h>
#define N 10
void InputMatrix(int (*a)[N],int n)
{
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            printf("please input the No.%d line No.%d row number:",i+1,j+1);
            scanf("%d",*(a+i)+j);
        }
    }
}
void Transpose(int (*a)[N],int n)
{
    int i,j,temp;
    for(i=0;i<n;i++)
    {
        for(j=0;j<=i;j++)
        {
            temp=*(*(a+i)+j);
            *(*(a+i)+j)=*(*(a+j)+i);
            *(*(a+j)+i)=temp;
        }
    }
}
void OutputMatrix(int (*a)[N],int n)
{
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            printf("%6d",*(*(a+i)+j));
        }
        putchar('\n');
    }
}
void main()
{
    int matrix[N][N];
    int n;
    printf("please input how many ranks:");
    scanf("%d",&n);
    InputMatrix(matrix,n);
    printf("before:\n");
    OutputMatrix(matrix,n);
    printf("after disposed:\n");
    Transpose(matrix,n);
    OutputMatrix(matrix,n);
}
